package com.createdevelopment.gaoyou.adapter;


import com.createdevelopment.gaoyou.R;

import android.annotation.SuppressLint;
import android.app.ActionBar.LayoutParams;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;


public class ImageAdapter extends BaseAdapter {
	private Context mContext;
	private Integer[] mThumbIds;
	private int width =LayoutParams.WRAP_CONTENT;
	private int height=LayoutParams.WRAP_CONTENT;

    public ImageAdapter(Context c) {
        mContext = c;
    }

    public int getCount() {
        return mThumbIds.length;
    }

    public Object getItem(int position) {
        return null;
    }

    public long getItemId(int position) {
        return 0;
    }

    // create a new ImageView for each item referenced by the Adapter
    @SuppressLint("NewApi")
	public View getView(int position, View convertView, ViewGroup parent) {
        ImageView imageView;
        if (convertView == null) {  // if it's not recycled, initialize some attributes
            imageView = new ImageView(mContext);
            //imageView.setScaleType(ImageView.ScaleType.FIT_XY);
            imageView.setLayoutParams( new GridView.LayoutParams(width, height));
        } else {
            imageView = (ImageView) convertView;
        }

        imageView.setImageResource(mThumbIds[position]);
        return imageView;
    }

	public Integer[] getmThumbIds() {
		return mThumbIds;
	}

	public void setmThumbIds(Integer[] mThumbIds) {
		this.mThumbIds = mThumbIds;
	}

	public int getWidth() {
		return width;
	}

	public void setWidth(int width) {
		this.width = width;
	}

	public int getHeight() {
		return height;
	}

	public void setHeight(int height) {
		this.height = height;
	}
    
   
}
